<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div id="app">
    <ul>
        <li v-for="blog in blogs" :key="blog.id">
          <h5>作者： {{ blog.author?blog.author:'佚名' }}</h5>
          <p>文章标题: {{blog.title}}</p>
        </li>
    </ul>
  </div>
  <script src="./vue.js"></script>
  <script src="./axios.js"></script>
  <script>
    const vm = new Vue({
      el: '#app',
      data: {
        blogs: []
      },
      methods: {
        fetchBlogs () {
          axios.post('https://api.it120.cc/conner/cms/news/list/v2', {
            page: 1,
            pageSize: 10
          }).then(res => {
            if(res.data.code === 0) {
              this.blogs = res.data.data.result
            }
          })
        }
      },
      created () {
        this.fetchBlogs();
      }
    })
  </script>
</body>
</html>